package com.stress.testing.plugin.nosql.redis.resolver;

import com.stress.testing.common.conf.AgentConfig;
import com.stress.testing.common.conf.PluginConfig;
import com.stress.testing.plugin.nosql.redis.deserializer.KeyDeserializer;
import com.stress.testing.plugin.nosql.redis.serializer.KeySerializer;
import com.stress.testing.plugin.nosql.redis.util.NumberUtils;
import com.stress.testing.plugin.nosql.redis.util.ReflectUtills;
import redis.clients.jedis.BitOP;
import redis.clients.jedis.BitPosParams;
import redis.clients.jedis.GeoCoordinate;
import redis.clients.jedis.GeoUnit;
import redis.clients.jedis.ListPosition;
import redis.clients.jedis.ScanParams;
import redis.clients.jedis.SortingParams;
import redis.clients.jedis.ZParams;
import redis.clients.jedis.params.GeoRadiusParam;
import redis.clients.jedis.params.MigrateParams;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;

import java.util.List;
import java.util.Map;

import static com.stress.testing.common.conf.PluginConfigKey.DEFAULT_NOSQL_REDIS_KEY_DESERIALIZER;
import static com.stress.testing.common.conf.PluginConfigKey.DEFAULT_NOSQL_REDIS_KEY_NAME_PREFIX;
import static com.stress.testing.common.conf.PluginConfigKey.DEFAULT_NOSQL_REDIS_KEY_SERIALIZER;
import static com.stress.testing.common.conf.PluginConfigKey.PLUGIN_NOSQL_REDIS_KEY_DESERIALIZER_KEY;
import static com.stress.testing.common.conf.PluginConfigKey.PLUGIN_NOSQL_REDIS_KEY_NAME_PREFIX_KEY;
import static com.stress.testing.common.conf.PluginConfigKey.PLUGIN_NOSQL_REDIS_KEY_SERIALIZER_KEY;

/**
 * jedis直接或间接实现的接口如下
 * 1、JedisCommands - 大部分命令是键值操作命令
 * 2、BinaryJedisCommands - 大部分命令是键值操作命令
 * 3、MultiKeyCommands - 大部分命令是键值操作命令
 * 4、MultiKeyBinaryCommands - 大部分命令是键值操作命令
 * 5、ScriptingCommands - 大部分命令是键值操作命令
 * 6、BinaryScriptingCommands - 大部分命令是键值操作命令
 * 7、ClusterCommands - 只有clusterKeySlot是键值操作命令
 * <p>
 * 8、BasicCommands - 没有键值操作命令
 * 9、AdvancedJedisCommands - 没有键值操作命令
 * 10、SentinelCommands - 没有键值操作命令
 * 11、AdvancedBinaryJedisCommands - 没有键值操作命令
 */
public class JedisMethodArgsResolver {
    private AgentConfig agentConfig;
    private PluginConfig pluginConfig;
    private String keyNamePrefix;
    private KeySerializer keySerializer;
    private KeyDeserializer keyDeserializer;

    public JedisMethodArgsResolver(AgentConfig agentConfig, PluginConfig pluginConfig) {
        this.agentConfig = agentConfig;
        this.pluginConfig = pluginConfig;
        this.keyNamePrefix = pluginConfig.get(PLUGIN_NOSQL_REDIS_KEY_NAME_PREFIX_KEY,
                DEFAULT_NOSQL_REDIS_KEY_NAME_PREFIX);

        String keySerializerClass = pluginConfig.get(PLUGIN_NOSQL_REDIS_KEY_SERIALIZER_KEY,
                DEFAULT_NOSQL_REDIS_KEY_SERIALIZER);
        this.keySerializer = ReflectUtills.newKeySerializerInstance(keySerializerClass);

        String keyDeserializerClass = pluginConfig.get(PLUGIN_NOSQL_REDIS_KEY_DESERIALIZER_KEY,
                DEFAULT_NOSQL_REDIS_KEY_DESERIALIZER);
        this.keyDeserializer = ReflectUtills.newKeyDeserializerInstance(keyDeserializerClass);
    }

    public ResolveResult set(byte[] key, byte[] value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, value);
    }

    public ResolveResult set(byte[] key, byte[] value, SetParams params) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, value, params);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, value, params);
    }

    public ResolveResult get(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult exists(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult persist(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult type(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult dump(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult restore(byte[] key, int ttl, byte[] serializedValue) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, ttl, serializedValue);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, ttl, serializedValue);
    }

    public ResolveResult restoreReplace(byte[] key, int ttl, byte[] serializedValue) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, ttl, serializedValue);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, ttl, serializedValue);
    }

    public ResolveResult expire(byte[] key, int seconds) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, seconds);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, seconds);
    }

    public ResolveResult pexpire(byte[] key, long milliseconds) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, milliseconds);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, milliseconds);
    }

    public ResolveResult expireAt(byte[] key, long unixTime) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, unixTime);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, unixTime);
    }

    public ResolveResult pexpireAt(byte[] key, long millisecondsTimestamp) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, millisecondsTimestamp);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, millisecondsTimestamp);
    }

    public ResolveResult ttl(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult pttl(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult touch(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult setbit(byte[] key, long offset, boolean value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, offset, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, offset, value);
    }

    public ResolveResult setbit(byte[] key, long offset, byte[] value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, offset, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, offset, value);
    }

    public ResolveResult getbit(byte[] key, long offset) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, offset);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, offset);
    }

    public ResolveResult setrange(byte[] key, long offset, byte[] value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, offset, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, offset, value);
    }

    public ResolveResult getrange(byte[] key, long startOffset, long endOffset) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, startOffset, endOffset);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, startOffset, endOffset);
    }

    public ResolveResult getSet(byte[] key, byte[] value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, value);
    }

    public ResolveResult setnx(byte[] key, byte[] value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, value);
    }

    public ResolveResult setex(byte[] key, int seconds, byte[] value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, seconds, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, seconds, value);
    }

    public ResolveResult psetex(byte[] key, long milliseconds, byte[] value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, milliseconds, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, milliseconds, value);
    }

    public ResolveResult decrBy(byte[] key, long decrement) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, decrement);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, decrement);
    }

    public ResolveResult decr(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult incrBy(byte[] key, long increment) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, increment);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, increment);
    }

    public ResolveResult incrByFloat(byte[] key, double increment) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, increment);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, increment);
    }

    public ResolveResult incr(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult append(byte[] key, byte[] value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, value);
    }

    public ResolveResult substr(byte[] key, int start, int end) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, end);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, start, end);
    }

    public ResolveResult hset(byte[] key, byte[] field, byte[] value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, field, value);
    }

    public ResolveResult hset(byte[] key, Map<byte[], byte[]> hash) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, hash);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, hash);
    }

    public ResolveResult hget(byte[] key, byte[] field) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, field);
    }

    public ResolveResult hsetnx(byte[] key, byte[] field, byte[] value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, field, value);
    }

    public ResolveResult hmset(byte[] key, Map<byte[], byte[]> hash) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, hash);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, hash);
    }

    public ResolveResult hmget(byte[] key, byte[]... fields) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, fields);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, fields);
    }

    public ResolveResult hincrBy(byte[] key, byte[] field, long value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, field, value);
    }

    public ResolveResult hincrByFloat(byte[] key, byte[] field, double value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, field, value);
    }

    public ResolveResult hexists(byte[] key, byte[] field) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, field);
    }

    public ResolveResult hdel(byte[] key, byte[]... field) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, field);
    }

    public ResolveResult hlen(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult hkeys(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult hvals(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult hgetAll(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult rpush(byte[] key, byte[]... args) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, args);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, args);
    }

    public ResolveResult lpush(byte[] key, byte[]... args) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, args);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, args);
    }

    public ResolveResult llen(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult lrange(byte[] key, long start, long stop) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, stop);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, start, stop);
    }

    public ResolveResult ltrim(byte[] key, long start, long stop) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, stop);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, start, stop);
    }

    public ResolveResult lindex(byte[] key, long index) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, index);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, index);
    }

    public ResolveResult lset(byte[] key, long index, byte[] value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, index, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, index, value);
    }

    public ResolveResult lrem(byte[] key, long count, byte[] value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, count, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, count, value);
    }

    public ResolveResult lpop(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult rpop(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult sadd(byte[] key, byte[]... member) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, member);
    }

    public ResolveResult smembers(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult srem(byte[] key, byte[]... member) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, member);
    }

    public ResolveResult spop(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult spop(byte[] key, long count) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, count);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, count);
    }

    public ResolveResult scard(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult sismember(byte[] key, byte[] member) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, member);
    }

    public ResolveResult srandmember(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult srandmember(byte[] key, int count) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, count);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, count);
    }

    public ResolveResult strlen(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult zadd(byte[] key, double score, byte[] member) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, score, member);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, score, member);
    }

    public ResolveResult zadd(byte[] key, double score, byte[] member, ZAddParams params) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, score, member, params);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, score, member, params);
    }

    public ResolveResult zadd(byte[] key, Map<byte[], Double> scoreMembers) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, scoreMembers);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, scoreMembers);
    }

    public ResolveResult zadd(byte[] key, Map<byte[], Double> scoreMembers, ZAddParams params) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, scoreMembers, params);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, scoreMembers, params);
    }

    public ResolveResult zrange(byte[] key, long start, long stop) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, stop);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, start, stop);
    }

    public ResolveResult zrem(byte[] key, byte[]... members) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, members);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, members);
    }

    public ResolveResult zincrby(byte[] key, double increment, byte[] member) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, increment, member);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, increment, member);
    }

    public ResolveResult zincrby(byte[] key, double increment, byte[] member, ZIncrByParams params) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, increment, member, params);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, increment, member, params);
    }

    public ResolveResult zrank(byte[] key, byte[] member) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, member);
    }

    public ResolveResult zrevrank(byte[] key, byte[] member) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, member);
    }

    public ResolveResult zrevrange(byte[] key, long start, long stop) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, stop);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, start, stop);
    }

    public ResolveResult zrangeWithScores(byte[] key, long start, long stop) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, stop);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, start, stop);
    }

    public ResolveResult zrevrangeWithScores(byte[] key, long start, long stop) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, stop);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, start, stop);
    }

    public ResolveResult zcard(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult zscore(byte[] key, byte[] member) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, member);
    }

    public ResolveResult sort(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult sort(byte[] key, SortingParams sortingParameters) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, sortingParameters);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, sortingParameters);
    }

    public ResolveResult zcount(byte[] key, double min, double max) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zcount(byte[] key, byte[] min, byte[] max) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zrangeByScore(byte[] key, double min, double max) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zrangeByScore(byte[] key, byte[] min, byte[] max) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zrevrangeByScore(byte[] key, double max, double min) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, max, min);
    }

    public ResolveResult zrangeByScore(byte[] key, double min, double max, int offset, int count) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max, offset, count);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max, offset, count);
    }

    public ResolveResult zrevrangeByScore(byte[] key, byte[] max, byte[] min) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, max, min);
    }

    public ResolveResult zrangeByScore(byte[] key, byte[] min, byte[] max, int offset, int count) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max, offset, count);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max, offset, count);
    }

    public ResolveResult zrevrangeByScore(byte[] key, double max, double min, int offset, int count) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min, offset, count);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, max, min, offset, count);
    }

    public ResolveResult zrangeByScoreWithScores(byte[] key, double min, double max) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zrevrangeByScoreWithScores(byte[] key, double max, double min) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, max, min);
    }

    public ResolveResult zrangeByScoreWithScores(byte[] key, double min, double max, int offset, int count) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max, offset, count);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max, offset, count);
    }

    public ResolveResult zrevrangeByScore(byte[] key, byte[] max, byte[] min, int offset, int count) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min, offset, count);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, max, min, offset, count);
    }

    public ResolveResult zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, max, min);
    }

    public ResolveResult zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max, int offset, int count) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max, offset, count);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max, offset, count);
    }

    public ResolveResult zrevrangeByScoreWithScores(byte[] key, double max, double min, int offset, int count) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min, offset, count);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, max, min, offset, count);
    }

    public ResolveResult zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min, int offset, int count) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min, offset, count);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, max, min, offset, count);
    }

    public ResolveResult zremrangeByRank(byte[] key, long start, long stop) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, stop);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, start, stop);
    }

    public ResolveResult zremrangeByScore(byte[] key, double min, double max) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zremrangeByScore(byte[] key, byte[] min, byte[] max) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zlexcount(byte[] key, byte[] min, byte[] max) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zrangeByLex(byte[] key, byte[] min, byte[] max) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zrangeByLex(byte[] key, byte[] min, byte[] max, int offset, int count) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max, offset, count);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max, offset, count);
    }

    public ResolveResult zrevrangeByLex(byte[] key, byte[] max, byte[] min) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, max, min);
    }

    public ResolveResult zrevrangeByLex(byte[] key, byte[] max, byte[] min, int offset, int count) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min, offset, count);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, max, min, offset, count);
    }

    public ResolveResult zremrangeByLex(byte[] key, byte[] min, byte[] max) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult linsert(byte[] key, ListPosition where, byte[] pivot, byte[] value) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, where, pivot, value);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, where, pivot, value);
    }

    public ResolveResult lpushx(byte[] key, byte[]... arg) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, arg);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, arg);
    }

    public ResolveResult rpushx(byte[] key, byte[]... arg) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, arg);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, arg);
    }

    public ResolveResult del(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult unlink(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult move(byte[] key, int dbIndex) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, dbIndex);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, dbIndex);
    }

    public ResolveResult bitcount(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult bitcount(byte[] key, long start, long end) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, end);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, start, end);
    }

    public ResolveResult pfadd(byte[] key, byte[]... elements) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, elements);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, elements);
    }

    public ResolveResult pfcount(byte[] key) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult geoadd(byte[] key, double longitude, double latitude, byte[] member) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, longitude, latitude, member);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, longitude, latitude, member);
    }

    public ResolveResult geoadd(byte[] key, Map<byte[], GeoCoordinate> memberCoordinateMap) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, memberCoordinateMap);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, memberCoordinateMap);
    }

    public ResolveResult geodist(byte[] key, byte[] member1, byte[] member2) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member1, member2);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, member1, member2);
    }

    public ResolveResult geodist(byte[] key, byte[] member1, byte[] member2, GeoUnit unit) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member1, member2, unit);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, member1, member2, unit);
    }

    public ResolveResult geohash(byte[] key, byte[]... members) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, members);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, members);
    }

    public ResolveResult geopos(byte[] key, byte[]... members) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, members);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, members);
    }

    public ResolveResult georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, longitude, latitude, radius, unit);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, longitude, latitude, radius, unit);
    }

    public ResolveResult georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, longitude, latitude, radius, unit);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, longitude, latitude, radius, unit);
    }

    public ResolveResult georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, longitude, latitude, radius, unit, param);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, longitude, latitude, radius, unit, param);
    }

    public ResolveResult georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, longitude, latitude, radius, unit, param);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, longitude, latitude, radius, unit, param);
    }

    public ResolveResult georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member, radius, unit);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, member, radius, unit);
    }

    public ResolveResult georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member, radius, unit);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, member, radius, unit);
    }

    public ResolveResult georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member, radius, unit, param);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, member, radius, unit, param);
    }

    public ResolveResult georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member, radius, unit, param);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, member, radius, unit, param);
    }

    public ResolveResult hscan(byte[] key, byte[] cursor) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, cursor);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, cursor);
    }

    public ResolveResult hscan(byte[] key, byte[] cursor, ScanParams params) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, cursor, params);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, cursor, params);
    }

    public ResolveResult sscan(byte[] key, byte[] cursor) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, cursor);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, cursor);
    }

    public ResolveResult sscan(byte[] key, byte[] cursor, ScanParams params) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, cursor, params);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, cursor, params);
    }

    public ResolveResult zscan(byte[] key, byte[] cursor) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, cursor);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, cursor);
    }

    public ResolveResult zscan(byte[] key, byte[] cursor, ScanParams params) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, cursor, params);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, cursor, params);
    }

    public ResolveResult bitfield(byte[] key, byte[]... arguments) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, arguments);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, arguments);
    }

    public ResolveResult hstrlen(byte[] key, byte[] field) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(key, field);
    }

    public ResolveResult eval(byte[] script, byte[] keyCount, byte[]... params) {
        int count = NumberUtils.byteArrayToInt(keyCount);
        if (count == 0) {
            return ResolveResult.renamedBefore(script, keyCount, params);
        }

        boolean renamedBefore = true;
        for (int i = 0; i < count; i++) {
            String sourceKey = keyDeserializer.deserialize(params[i]);
            // 所有的key都要以keyNamePrefix开头
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        // 不存在key不是以keyNamePrefix开头
        if (renamedBefore) {
            return ResolveResult.renamedBefore(script, keyCount, params);
        }

        // 改变key
        // 看似有2个循环，实质上只有一个循环在真正执行
        for (int i = 0; i < count; i++) {
            String sourceKey = keyDeserializer.deserialize(params[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                params[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(script, keyCount, params);
    }

    public ResolveResult eval(byte[] script, int keyCount, byte[]... params) {
        if (keyCount == 0) {
            return ResolveResult.renamedBefore(script, keyCount, params);
        }

        boolean renamedBefore = true;
        for (int i = 0; i < keyCount; i++) {
            String sourceKey = keyDeserializer.deserialize(params[i]);
            // 所有的key都要以keyNamePrefix开头
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        // 不存在key不是以keyNamePrefix开头
        if (renamedBefore) {
            return ResolveResult.renamedBefore(script, keyCount, params);
        }

        // 改变key
        // 看似有2个循环，实质上只有一个循环在真正执行
        for (int i = 0; i < keyCount; i++) {
            String sourceKey = keyDeserializer.deserialize(params[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                params[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(script, keyCount, params);
    }

    public ResolveResult eval(byte[] script, List<byte[]> keys, List<byte[]> args) {
        if (keys == null || keys.size() == 0) {
            ResolveResult.renamedBefore(script, keys, args);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            // 所有的key都要以keyNamePrefix开头
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        // 不存在key不是以keyNamePrefix开头
        if (renamedBefore) {
            return ResolveResult.renamedBefore(script, keys, args);
        }

        // 改变key
        // 看似有2个循环，实质上只有一个循环在真正执行
        for (int i = 0; i < keys.size(); i++) {
            String sourceKey = keyDeserializer.deserialize(keys.get(i));
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys.set(i, keySerializer.serialize(destKey));
            }
        }

        return ResolveResult.UnRenamedBefore(script, keys, args);
    }

    public ResolveResult evalsha(byte[] sha1, List<byte[]> keys, List<byte[]> args) {
        if (keys == null || keys.size() == 0) {
            ResolveResult.renamedBefore(sha1, keys, args);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            // 所有的key都要以keyNamePrefix开头
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        // 不存在key不是以keyNamePrefix开头
        if (renamedBefore) {
            return ResolveResult.renamedBefore(sha1, keys, args);
        }

        // 改变key
        // 看似有2个循环，实质上只有一个循环在真正执行
        for (int i = 0; i < keys.size(); i++) {
            String sourceKey = keyDeserializer.deserialize(keys.get(i));
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys.set(i, keySerializer.serialize(destKey));
            }
        }

        return ResolveResult.UnRenamedBefore(sha1, keys, args);
    }

    public ResolveResult evalsha(byte[] sha1, int keyCount, byte[]... params) {
        if (keyCount == 0) {
            return ResolveResult.renamedBefore(sha1, keyCount, params);
        }

        boolean renamedBefore = true;
        for (int i = 0; i < keyCount; i++) {
            String sourceKey = keyDeserializer.deserialize(params[i]);
            // 所有的key都要以keyNamePrefix开头
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        // 不存在key不是以keyNamePrefix开头
        if (renamedBefore) {
            return ResolveResult.renamedBefore(sha1, keyCount, params);
        }

        // 改变key
        // 看似有2个循环，实质上只有一个循环在真正执行
        for (int i = 0; i < keyCount; i++) {
            String sourceKey = keyDeserializer.deserialize(params[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                params[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(sha1, keyCount, params);
    }

    public ResolveResult clusterKeySlot(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult set(String key, String value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, value);
    }

    public ResolveResult set(String key, String value, SetParams params) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, value, params);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, value, params);
    }

    public ResolveResult get(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult exists(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult persist(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult type(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult dump(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult restore(String key, int ttl, byte[] serializedValue) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, ttl, serializedValue);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, ttl, serializedValue);
    }

    public ResolveResult restoreReplace(String key, int ttl, byte[] serializedValue) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, ttl, serializedValue);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, ttl, serializedValue);
    }

    public ResolveResult expire(String key, int seconds) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, seconds);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, seconds);
    }

    public ResolveResult pexpire(String key, long milliseconds) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, milliseconds);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, milliseconds);
    }

    public ResolveResult expireAt(String key, long unixTime) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, unixTime);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, unixTime);
    }

    public ResolveResult pexpireAt(String key, long millisecondsTimestamp) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, millisecondsTimestamp);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, millisecondsTimestamp);
    }

    public ResolveResult ttl(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult pttl(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult touch(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult setbit(String key, long offset, boolean value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, offset, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, offset, value);
    }

    public ResolveResult setbit(String key, long offset, String value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, offset, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, offset, value);
    }

    public ResolveResult getbit(String key, long offset) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, offset);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, offset);
    }

    public ResolveResult setrange(String key, long offset, String value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, offset, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, offset, value);
    }

    public ResolveResult getrange(String key, long startOffset, long endOffset) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, startOffset, endOffset);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, startOffset, endOffset);
    }

    public ResolveResult getSet(String key, String value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, value);
    }

    public ResolveResult setnx(String key, String value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, value);
    }

    public ResolveResult setex(String key, int seconds, String value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, seconds, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, seconds, value);
    }

    public ResolveResult psetex(String key, long milliseconds, String value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, milliseconds, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, milliseconds, value);
    }

    public ResolveResult decrBy(String key, long decrement) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, decrement);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, decrement);
    }

    public ResolveResult decr(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult incrBy(String key, long increment) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, increment);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, increment);
    }

    public ResolveResult incrByFloat(String key, double increment) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, increment);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, increment);
    }

    public ResolveResult incr(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult append(String key, String value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, value);
    }

    public ResolveResult substr(String key, int start, int end) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, end);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, start, end);
    }

    public ResolveResult hset(String key, String field, String value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, field, value);
    }

    public ResolveResult hset(String key, Map<String, String> hash) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, hash);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, hash);
    }

    public ResolveResult hget(String key, String field) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, field);
    }

    public ResolveResult hsetnx(String key, String field, String value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, field, value);
    }

    public ResolveResult hmset(String key, Map<String, String> hash) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, hash);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, hash);
    }

    public ResolveResult hmget(String key, String... fields) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, fields);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, fields);
    }

    public ResolveResult hincrBy(String key, String field, long value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, field, value);
    }

    public ResolveResult hincrByFloat(String key, String field, double value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, field, value);
    }

    public ResolveResult hexists(String key, String field) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, field);
    }

    public ResolveResult hdel(String key, String... field) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, field);
    }

    public ResolveResult hlen(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult hkeys(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult hvals(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult hgetAll(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult rpush(String key, String... string) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, string);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, string);
    }

    public ResolveResult lpush(String key, String... string) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, string);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, string);
    }

    public ResolveResult llen(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult lrange(String key, long start, long stop) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, stop);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, start, stop);
    }

    public ResolveResult ltrim(String key, long start, long stop) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, stop);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, start, stop);
    }

    public ResolveResult lindex(String key, long index) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, index);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, index);
    }

    public ResolveResult lset(String key, long index, String value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, index, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, index, value);
    }

    public ResolveResult lrem(String key, long count, String value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, count, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, count, value);
    }

    public ResolveResult lpop(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult rpop(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult sadd(String key, String... member) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, member);
    }

    public ResolveResult smembers(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult srem(String key, String... member) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, member);
    }

    public ResolveResult spop(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult spop(String key, long count) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, count);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, count);
    }

    public ResolveResult scard(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult sismember(String key, String member) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, member);
    }

    public ResolveResult srandmember(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult srandmember(String key, int count) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, count);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, count);
    }

    public ResolveResult strlen(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult zadd(String key, double score, String member) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, score, member);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, score, member);
    }

    public ResolveResult zadd(String key, double score, String member, ZAddParams params) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, score, member, params);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, score, member, params);
    }

    public ResolveResult zadd(String key, Map<String, Double> scoreMembers) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, scoreMembers);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, scoreMembers);
    }

    public ResolveResult zadd(String key, Map<String, Double> scoreMembers, ZAddParams params) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, scoreMembers, params);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, scoreMembers, params);
    }

    public ResolveResult zrange(String key, long start, long stop) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, stop);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, start, stop);
    }

    public ResolveResult zrem(String key, String... members) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, members);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, members);
    }

    public ResolveResult zincrby(String key, double increment, String member) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, increment, member);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, increment, member);
    }

    public ResolveResult zincrby(String key, double increment, String member, ZIncrByParams params) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, increment, member, params);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, increment, member, params);
    }

    public ResolveResult zrank(String key, String member) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, member);
    }

    public ResolveResult zrevrank(String key, String member) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, member);
    }

    public ResolveResult zrevrange(String key, long start, long stop) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, stop);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, start, stop);
    }

    public ResolveResult zrangeWithScores(String key, long start, long stop) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, stop);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, start, stop);
    }

    public ResolveResult zrevrangeWithScores(String key, long start, long stop) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, stop);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, start, stop);
    }

    public ResolveResult zcard(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult zscore(String key, String member) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, member);
    }

    public ResolveResult sort(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult sort(String key, SortingParams sortingParameters) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, sortingParameters);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, sortingParameters);
    }

    public ResolveResult zcount(String key, double min, double max) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zcount(String key, String min, String max) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zrangeByScore(String key, double min, double max) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zrangeByScore(String key, String min, String max) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zrevrangeByScore(String key, double max, double min) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, max, min);
    }

    public ResolveResult zrangeByScore(String key, double min, double max, int offset, int count) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max, offset, count);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max, offset, count);
    }

    public ResolveResult zrevrangeByScore(String key, String max, String min) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, max, min);
    }

    public ResolveResult zrangeByScore(String key, String min, String max, int offset, int count) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max, offset, count);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max, offset, count);
    }

    public ResolveResult zrevrangeByScore(String key, double max, double min, int offset, int count) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min, offset, count);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, max, min, offset, count);
    }

    public ResolveResult zrangeByScoreWithScores(String key, double min, double max) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zrevrangeByScoreWithScores(String key, double max, double min) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, max, min);
    }

    public ResolveResult zrangeByScoreWithScores(String key, double min, double max, int offset, int count) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max, offset, count);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max, offset, count);
    }

    public ResolveResult zrevrangeByScore(String key, String max, String min, int offset, int count) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min, offset, count);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, max, min, offset, count);
    }

    public ResolveResult zrangeByScoreWithScores(String key, String min, String max) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zrevrangeByScoreWithScores(String key, String max, String min) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, max, min);
    }

    public ResolveResult zrangeByScoreWithScores(String key, String min, String max, int offset, int count) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max, offset, count);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max, offset, count);
    }

    public ResolveResult zrevrangeByScoreWithScores(String key, double max, double min, int offset, int count) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min, offset, count);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, max, min, offset, count);
    }

    public ResolveResult zrevrangeByScoreWithScores(String key, String max, String min, int offset, int count) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min, offset, count);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, max, min, offset, count);
    }

    public ResolveResult zremrangeByRank(String key, long start, long stop) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, stop);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, start, stop);
    }

    public ResolveResult zremrangeByScore(String key, double min, double max) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zremrangeByScore(String key, String min, String max) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zlexcount(String key, String min, String max) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zrangeByLex(String key, String min, String max) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult zrangeByLex(String key, String min, String max, int offset, int count) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max, offset, count);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max, offset, count);
    }

    public ResolveResult zrevrangeByLex(String key, String max, String min) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, max, min);
    }

    public ResolveResult zrevrangeByLex(String key, String max, String min, int offset, int count) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, max, min, offset, count);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, max, min, offset, count);
    }

    public ResolveResult zremrangeByLex(String key, String min, String max) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, min, max);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, min, max);
    }

    public ResolveResult linsert(String key, ListPosition where, String pivot, String value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, where, pivot, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, where, pivot, value);
    }

    public ResolveResult lpushx(String key, String... string) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, string);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, string);
    }

    public ResolveResult rpushx(String key, String... string) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, string);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, string);
    }

    public ResolveResult blpop(int timeout, String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(timeout, key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(timeout, key);
    }

    public ResolveResult brpop(int timeout, String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(timeout, key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(timeout, key);
    }

    public ResolveResult del(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult unlink(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult move(String key, int dbIndex) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, dbIndex);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, dbIndex);
    }

    public ResolveResult bitcount(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult bitcount(String key, long start, long end) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, start, end);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, start, end);
    }

    public ResolveResult bitpos(String key, boolean value) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, value);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, value);
    }

    public ResolveResult bitpos(String key, boolean value, BitPosParams params) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, value, params);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, value, params);
    }

    public ResolveResult hscan(String key, String cursor) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, cursor);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, cursor);
    }

    public ResolveResult hscan(String key, String cursor, ScanParams params) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, cursor, params);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, cursor, params);
    }

    public ResolveResult sscan(String key, String cursor) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, cursor);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, cursor);
    }

    public ResolveResult zscan(String key, String cursor) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, cursor);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, cursor);
    }

    public ResolveResult zscan(String key, String cursor, ScanParams params) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, cursor, params);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, cursor, params);
    }

    public ResolveResult sscan(String key, String cursor, ScanParams params) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, cursor, params);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, cursor, params);
    }

    public ResolveResult pfadd(String key, String... elements) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, elements);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, elements);
    }

    public ResolveResult pfcount(String key) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key);
    }

    public ResolveResult geoadd(String key, double longitude, double latitude, String member) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, longitude, latitude, member);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, longitude, latitude, member);
    }

    public ResolveResult geoadd(String key, Map<String, GeoCoordinate> memberCoordinateMap) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, memberCoordinateMap);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, memberCoordinateMap);
    }

    public ResolveResult geodist(String key, String member1, String member2) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member1, member2);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, member1, member2);
    }

    public ResolveResult geodist(String key, String member1, String member2, GeoUnit unit) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member1, member2, unit);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, member1, member2, unit);
    }

    public ResolveResult geohash(String key, String... members) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, members);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, members);
    }

    public ResolveResult geopos(String key, String... members) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, members);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, members);
    }

    public ResolveResult georadius(String key, double longitude, double latitude, double radius, GeoUnit unit) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, longitude, latitude, radius, unit);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, longitude, latitude, radius, unit);
    }

    public ResolveResult georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, longitude, latitude, radius, unit);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, longitude, latitude, radius, unit);
    }

    public ResolveResult georadius(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, longitude, latitude, radius, unit, param);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, longitude, latitude, radius, unit, param);
    }

    public ResolveResult georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, longitude, latitude, radius, unit, param);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, longitude, latitude, radius, unit, param);
    }

    public ResolveResult georadiusByMember(String key, String member, double radius, GeoUnit unit) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member, radius, unit);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, member, radius, unit);
    }

    public ResolveResult georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member, radius, unit);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, member, radius, unit);
    }

    public ResolveResult georadiusByMember(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member, radius, unit, param);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, member, radius, unit, param);
    }

    public ResolveResult georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, member, radius, unit, param);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, member, radius, unit, param);
    }

    public ResolveResult bitfield(String key, String... arguments) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, key, arguments);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, arguments);
    }

    public ResolveResult hstrlen(String key, String field) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, field);
        }

        key = keyNamePrefix + key;
        return ResolveResult.UnRenamedBefore(key, field);
    }

    public ResolveResult del(byte[]... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult unlink(byte[]... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult exists(byte[]... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult blpop(int timeout, byte[]... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(timeout, keys);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(timeout, keys);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(timeout, keys);
    }

    public ResolveResult brpop(int timeout, byte[]... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(timeout, keys);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(timeout, keys);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(timeout, keys);
    }

    /**
     * redis命令：BLPOP key [key ...] timeout
     *
     * @param args
     * @return
     */
    public ResolveResult blpop(byte[]... args) {
        if (args == null || args.length < 2) {
            return ResolveResult.renamedBefore(args);
        }

        boolean renamedBefore = true;
        for (int i = 0; i < args.length - 1; i++) {
            String sourceKey = keyDeserializer.deserialize(args[i]);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(args);
        }

        for (int i = 0; i < args.length - 1; i++) {
            String sourceKey = keyDeserializer.deserialize(args[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                args[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(args);
    }

    /**
     * BRPOP key [key ...] timeout
     *
     * @param args
     * @return
     */
    public ResolveResult brpop(byte[]... args) {
        if (args == null || args.length < 2) {
            return ResolveResult.renamedBefore(args);
        }

        boolean renamedBefore = true;
        for (int i = 0; i < args.length - 1; i++) {
            String sourceKey = keyDeserializer.deserialize(args[i]);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(args);
        }

        for (int i = 0; i < args.length - 1; i++) {
            String sourceKey = keyDeserializer.deserialize(args[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                args[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(args);
    }

    public ResolveResult mget(byte[]... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult mset(byte[]... keysvalues) {
        if (keysvalues == null || keysvalues.length == 0) {
            return ResolveResult.renamedBefore(keysvalues);
        }

        boolean renamedBefore = true;
        for (int i = 0; i < keysvalues.length; i = i + 2) {
            String sourceKey = keyDeserializer.deserialize(keysvalues[i]);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keysvalues);
        }

        for (int i = 0; i < keysvalues.length; i = i + 2) {
            String sourceKey = keyDeserializer.deserialize(keysvalues[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keysvalues[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(keysvalues);
    }

    public ResolveResult msetnx(byte[]... keysvalues) {
        if (keysvalues == null || keysvalues.length == 0) {
            return ResolveResult.renamedBefore(keysvalues);
        }

        boolean renamedBefore = true;
        for (int i = 0; i < keysvalues.length; i = i + 2) {
            String sourceKey = keyDeserializer.deserialize(keysvalues[i]);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keysvalues);
        }

        for (int i = 0; i < keysvalues.length; i = i + 2) {
            String sourceKey = keyDeserializer.deserialize(keysvalues[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keysvalues[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(keysvalues);
    }

    public ResolveResult rename(byte[] oldkey, byte[] newkey) {
        String oldkeyStr = keyDeserializer.deserialize(oldkey);
        String newkeyStr = keyDeserializer.deserialize(newkey);

        if (oldkeyStr.startsWith(keyNamePrefix) && newkeyStr.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(oldkey, newkey);
        }

        if (!oldkeyStr.startsWith(keyNamePrefix)) {
            oldkey = keySerializer.serialize(keyNamePrefix + oldkeyStr);
        }

        if (!newkeyStr.startsWith(keyNamePrefix)) {
            newkey = keySerializer.serialize(keyNamePrefix + newkeyStr);
        }

        return ResolveResult.UnRenamedBefore(oldkey, newkey);
    }

    public ResolveResult renamenx(byte[] oldkey, byte[] newkey) {
        String oldkeyStr = keyDeserializer.deserialize(oldkey);
        String newkeyStr = keyDeserializer.deserialize(newkey);

        if (oldkeyStr.startsWith(keyNamePrefix) && newkeyStr.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(oldkey, newkey);
        }

        if (!oldkeyStr.startsWith(keyNamePrefix)) {
            oldkey = keySerializer.serialize(keyNamePrefix + oldkeyStr);
        }

        if (!newkeyStr.startsWith(keyNamePrefix)) {
            newkey = keySerializer.serialize(keyNamePrefix + newkeyStr);
        }

        return ResolveResult.UnRenamedBefore(oldkey, newkey);
    }

    public ResolveResult rpoplpush(byte[] srckey, byte[] dstkey) {
        String srckeyStr = keyDeserializer.deserialize(srckey);
        String dstkeyStr = keyDeserializer.deserialize(dstkey);

        if (srckeyStr.startsWith(keyNamePrefix) && dstkeyStr.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(srckey, dstkey);
        }

        if (!srckeyStr.startsWith(keyNamePrefix)) {
            srckey = keySerializer.serialize(keyNamePrefix + srckeyStr);
        }

        if (!dstkeyStr.startsWith(keyNamePrefix)) {
            dstkey = keySerializer.serialize(keyNamePrefix + dstkeyStr);
        }

        return ResolveResult.UnRenamedBefore(srckey, dstkey);
    }

    public ResolveResult sdiff(byte[]... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult sdiffstore(byte[] dstkey, byte[]... keys) {
        boolean renamedBefore = true;
        String dstkeyStr = keyDeserializer.deserialize(dstkey);
        renamedBefore = renamedBefore && dstkeyStr.startsWith(keyNamePrefix);

        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(dstkey, keys);
        }

        if (!dstkeyStr.startsWith(keyNamePrefix)) {
            dstkey = keySerializer.serialize(keyNamePrefix + dstkeyStr);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(dstkey, keys);
    }

    public ResolveResult sinter(byte[]... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult sinterstore(byte[] dstkey, byte[]... keys) {
        boolean renamedBefore = true;
        String dstkeyStr = keyDeserializer.deserialize(dstkey);
        renamedBefore = renamedBefore && dstkeyStr.startsWith(keyNamePrefix);

        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(dstkey, keys);
        }

        if (!dstkeyStr.startsWith(keyNamePrefix)) {
            dstkey = keySerializer.serialize(keyNamePrefix + dstkeyStr);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(dstkey, keys);
    }

    public ResolveResult smove(byte[] srckey, byte[] dstkey, byte[] member) {
        String srckeyStr = keyDeserializer.deserialize(srckey);
        String dstkeyStr = keyDeserializer.deserialize(dstkey);

        if (srckeyStr.startsWith(keyNamePrefix) && dstkeyStr.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(srckey, dstkey, member);
        }

        if (!srckeyStr.startsWith(keyNamePrefix)) {
            srckey = keySerializer.serialize(keyNamePrefix + srckeyStr);
        }

        if (!dstkeyStr.startsWith(keyNamePrefix)) {
            dstkey = keySerializer.serialize(keyNamePrefix + dstkeyStr);
        }

        return ResolveResult.UnRenamedBefore(srckey, dstkey, member);
    }

    public ResolveResult sort(byte[] key, SortingParams sortingParameters, byte[] dstkey) {
        String keyStr = keyDeserializer.deserialize(key);
        String dstkeyStr = keyDeserializer.deserialize(dstkey);

        if (keyStr.startsWith(keyNamePrefix) && dstkeyStr.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, sortingParameters, dstkey);
        }

        if (!keyStr.startsWith(keyNamePrefix)) {
            key = keySerializer.serialize(keyNamePrefix + keyStr);
        }

        if (!dstkeyStr.startsWith(keyNamePrefix)) {
            dstkey = keySerializer.serialize(keyNamePrefix + dstkeyStr);
        }

        return ResolveResult.UnRenamedBefore(key, sortingParameters, dstkey);
    }

    public ResolveResult sort(byte[] key, byte[] dstkey) {
        String keyStr = keyDeserializer.deserialize(key);
        String dstkeyStr = keyDeserializer.deserialize(dstkey);

        if (keyStr.startsWith(keyNamePrefix) && dstkeyStr.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, dstkey);
        }

        if (!keyStr.startsWith(keyNamePrefix)) {
            key = keySerializer.serialize(keyNamePrefix + keyStr);
        }

        if (!dstkeyStr.startsWith(keyNamePrefix)) {
            dstkey = keySerializer.serialize(keyNamePrefix + dstkeyStr);
        }

        return ResolveResult.UnRenamedBefore(key, dstkey);
    }

    public ResolveResult sunion(byte[]... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult sunionstore(byte[] dstkey, byte[]... keys) {
        boolean renamedBefore = true;
        String dstkeyStr = keyDeserializer.deserialize(dstkey);
        renamedBefore = renamedBefore && dstkeyStr.startsWith(keyNamePrefix);

        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(dstkey, keys);
        }

        if (!dstkeyStr.startsWith(keyNamePrefix)) {
            dstkey = keySerializer.serialize(keyNamePrefix + dstkeyStr);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(dstkey, keys);
    }

    public ResolveResult watch(byte[]... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult zinterstore(byte[] dstkey, byte[]... sets) {
        boolean renamedBefore = true;
        String dstkeyStr = keyDeserializer.deserialize(dstkey);
        renamedBefore = renamedBefore && dstkeyStr.startsWith(keyNamePrefix);

        for (byte[] key : sets) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(dstkey, sets);
        }

        if (!dstkeyStr.startsWith(keyNamePrefix)) {
            dstkey = keySerializer.serialize(keyNamePrefix + dstkeyStr);
        }

        for (int i = 0; i < sets.length; i++) {
            String sourceKey = keyDeserializer.deserialize(sets[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                sets[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(dstkey, sets);
    }

    public ResolveResult zinterstore(byte[] dstkey, ZParams params, byte[]... sets) {
        boolean renamedBefore = true;
        String dstkeyStr = keyDeserializer.deserialize(dstkey);
        renamedBefore = renamedBefore && dstkeyStr.startsWith(keyNamePrefix);

        for (byte[] key : sets) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(dstkey, params, sets);
        }

        if (!dstkeyStr.startsWith(keyNamePrefix)) {
            dstkey = keySerializer.serialize(keyNamePrefix + dstkeyStr);
        }

        for (int i = 0; i < sets.length; i++) {
            String sourceKey = keyDeserializer.deserialize(sets[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                sets[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(dstkey, params, sets);
    }

    public ResolveResult zunionstore(byte[] dstkey, byte[]... sets) {
        boolean renamedBefore = true;
        String dstkeyStr = keyDeserializer.deserialize(dstkey);
        renamedBefore = renamedBefore && dstkeyStr.startsWith(keyNamePrefix);

        for (byte[] key : sets) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(dstkey, sets);
        }

        if (!dstkeyStr.startsWith(keyNamePrefix)) {
            dstkey = keySerializer.serialize(keyNamePrefix + dstkeyStr);
        }

        for (int i = 0; i < sets.length; i++) {
            String sourceKey = keyDeserializer.deserialize(sets[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                sets[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(dstkey, sets);
    }

    public ResolveResult zunionstore(byte[] dstkey, ZParams params, byte[]... sets) {
        boolean renamedBefore = true;
        String dstkeyStr = keyDeserializer.deserialize(dstkey);
        renamedBefore = renamedBefore && dstkeyStr.startsWith(keyNamePrefix);

        for (byte[] key : sets) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(dstkey, params, sets);
        }

        if (!dstkeyStr.startsWith(keyNamePrefix)) {
            dstkey = keySerializer.serialize(keyNamePrefix + dstkeyStr);
        }

        for (int i = 0; i < sets.length; i++) {
            String sourceKey = keyDeserializer.deserialize(sets[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                sets[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(dstkey, params, sets);
    }

    public ResolveResult brpoplpush(byte[] source, byte[] destination, int timeout) {
        String sourceStr = keyDeserializer.deserialize(source);
        String destStr = keyDeserializer.deserialize(destination);

        if (sourceStr.startsWith(keyNamePrefix) && destStr.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(source, destination, timeout);
        }

        if (!sourceStr.startsWith(keyNamePrefix)) {
            source = keySerializer.serialize(keyNamePrefix + sourceStr);
        }

        if (!destStr.startsWith(keyNamePrefix)) {
            destination = keySerializer.serialize(keyNamePrefix + destStr);
        }

        return ResolveResult.UnRenamedBefore(source, destination, timeout);
    }

    public ResolveResult bitop(BitOP op, byte[] destKey, byte[]... srcKeys) {
        boolean renamedBefore = true;
        String dstkeyStr = keyDeserializer.deserialize(destKey);
        renamedBefore = renamedBefore && dstkeyStr.startsWith(keyNamePrefix);

        for (byte[] key : srcKeys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(op, destKey, srcKeys);
        }

        if (!dstkeyStr.startsWith(keyNamePrefix)) {
            destKey = keySerializer.serialize(keyNamePrefix + dstkeyStr);
        }

        for (int i = 0; i < srcKeys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(srcKeys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String keyStr = keyNamePrefix + sourceKey;
                srcKeys[i] = keySerializer.serialize(keyStr);
            }
        }

        return ResolveResult.UnRenamedBefore(op, destKey, srcKeys);
    }

    public ResolveResult pfmerge(byte[] destkey, byte[]... sourcekeys) {
        boolean renamedBefore = true;
        String dstkeyStr = keyDeserializer.deserialize(destkey);
        renamedBefore = renamedBefore && dstkeyStr.startsWith(keyNamePrefix);

        for (byte[] key : sourcekeys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(destkey, sourcekeys);
        }

        if (!dstkeyStr.startsWith(keyNamePrefix)) {
            destkey = keySerializer.serialize(keyNamePrefix + dstkeyStr);
        }

        for (int i = 0; i < sourcekeys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(sourcekeys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String keyStr = keyNamePrefix + sourceKey;
                sourcekeys[i] = keySerializer.serialize(keyStr);
            }
        }

        return ResolveResult.UnRenamedBefore(destkey, sourcekeys);
    }

    public ResolveResult pfcount(byte[]... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult touch(byte[]... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult del(String... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult unlink(String... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult exists(String... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult blpop(int timeout, String... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(timeout, keys);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(timeout, keys);
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(timeout, keys);
    }

    public ResolveResult brpop(int timeout, String... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(timeout, keys);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(timeout, keys);
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(timeout, keys);
    }

    public ResolveResult blpop(String... args) {
        if (args == null || args.length < 2) {
            return ResolveResult.renamedBefore(args);
        }

        boolean renamedBefore = true;
        for (int i = 0; i < args.length - 1; i++) {
            renamedBefore = renamedBefore && args[i].startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(args);
        }

        for (int i = 0; i < args.length - 1; i++) {
            if (!args[i].startsWith(keyNamePrefix)) {
                args[i] = keyNamePrefix + args[i];
            }
        }

        return ResolveResult.UnRenamedBefore(args);
    }

    public ResolveResult brpop(String... args) {
        if (args == null || args.length < 2) {
            return ResolveResult.renamedBefore(args);
        }

        boolean renamedBefore = true;
        for (int i = 0; i < args.length - 1; i++) {
            renamedBefore = renamedBefore && args[i].startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(args);
        }

        for (int i = 0; i < args.length - 1; i++) {
            if (!args[i].startsWith(keyNamePrefix)) {
                args[i] = keyNamePrefix + args[i];
            }
        }

        return ResolveResult.UnRenamedBefore(args);
    }

    public ResolveResult mget(String... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult mset(String... keysvalues) {
        if (keysvalues == null || keysvalues.length == 0) {
            return ResolveResult.renamedBefore(keysvalues);
        }

        boolean renamedBefore = true;
        for (int i = 0; i < keysvalues.length; i = i + 2) {
            renamedBefore = renamedBefore && keysvalues[i].startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keysvalues);
        }

        for (int i = 0; i < keysvalues.length; i = i + 2) {
            if (!keysvalues[i].startsWith(keyNamePrefix)) {
                keysvalues[i] = keyNamePrefix + keysvalues[i];
            }
        }

        return ResolveResult.UnRenamedBefore(keysvalues);
    }

    public ResolveResult msetnx(String... keysvalues) {
        if (keysvalues == null || keysvalues.length == 0) {
            return ResolveResult.renamedBefore(keysvalues);
        }

        boolean renamedBefore = true;
        for (int i = 0; i < keysvalues.length; i = i + 2) {
            renamedBefore = renamedBefore && keysvalues[i].startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keysvalues);
        }

        for (int i = 0; i < keysvalues.length; i = i + 2) {
            if (!keysvalues[i].startsWith(keyNamePrefix)) {
                keysvalues[i] = keyNamePrefix + keysvalues[i];
            }
        }

        return ResolveResult.UnRenamedBefore(keysvalues);
    }

    public ResolveResult rename(String oldkey, String newkey) {
        if (oldkey.startsWith(keyNamePrefix) && newkey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(oldkey, newkey);
        }

        if (!oldkey.startsWith(keyNamePrefix)) {
            oldkey = keyNamePrefix + oldkey;
        }

        if (!newkey.startsWith(keyNamePrefix)) {
            newkey = keyNamePrefix + newkey;
        }

        return ResolveResult.UnRenamedBefore(oldkey, newkey);
    }

    public ResolveResult renamenx(String oldkey, String newkey) {
        if (oldkey.startsWith(keyNamePrefix) && newkey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(oldkey, newkey);
        }

        if (!oldkey.startsWith(keyNamePrefix)) {
            oldkey = keyNamePrefix + oldkey;
        }

        if (!newkey.startsWith(keyNamePrefix)) {
            newkey = keyNamePrefix + newkey;
        }

        return ResolveResult.UnRenamedBefore(oldkey, newkey);
    }

    public ResolveResult rpoplpush(String srckey, String dstkey) {
        if (srckey.startsWith(keyNamePrefix) && dstkey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(srckey, dstkey);
        }

        if (!srckey.startsWith(keyNamePrefix)) {
            srckey = keyNamePrefix + srckey;
        }

        if (!dstkey.startsWith(keyNamePrefix)) {
            dstkey = keyNamePrefix + dstkey;
        }

        return ResolveResult.UnRenamedBefore(srckey, dstkey);
    }

    public ResolveResult sdiff(String... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult sdiffstore(String dstkey, String... keys) {
        boolean renamedBefore = true;
        renamedBefore = renamedBefore && dstkey.startsWith(keyNamePrefix);

        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(dstkey, keys);
        }

        if (!dstkey.startsWith(keyNamePrefix)) {
            dstkey = keyNamePrefix + dstkey;
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(dstkey, keys);
    }

    public ResolveResult sinter(String... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult sinterstore(String dstkey, String... keys) {
        boolean renamedBefore = true;
        renamedBefore = renamedBefore && dstkey.startsWith(keyNamePrefix);

        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(dstkey, keys);
        }

        if (!dstkey.startsWith(keyNamePrefix)) {
            dstkey = keyNamePrefix + dstkey;
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(dstkey, keys);
    }

    public ResolveResult smove(String srckey, String dstkey, String member) {
        if (srckey.startsWith(keyNamePrefix) && dstkey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(srckey, dstkey, member);
        }

        if (!srckey.startsWith(keyNamePrefix)) {
            srckey = keyNamePrefix + srckey;
        }

        if (!dstkey.startsWith(keyNamePrefix)) {
            dstkey = keyNamePrefix + dstkey;
        }

        return ResolveResult.UnRenamedBefore(srckey, dstkey, member);
    }

    public ResolveResult sort(String key, SortingParams sortingParameters, String dstkey) {
        if (key.startsWith(keyNamePrefix) && dstkey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, sortingParameters, dstkey);
        }

        if (!key.startsWith(keyNamePrefix)) {
            key = keyNamePrefix + key;
        }

        if (!dstkey.startsWith(keyNamePrefix)) {
            dstkey = keyNamePrefix + dstkey;
        }

        return ResolveResult.UnRenamedBefore(key, sortingParameters, dstkey);
    }

    public ResolveResult sort(String key, String dstkey) {
        if (key.startsWith(keyNamePrefix) && dstkey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(key, dstkey);
        }

        if (!key.startsWith(keyNamePrefix)) {
            key = keyNamePrefix + key;
        }

        if (!dstkey.startsWith(keyNamePrefix)) {
            dstkey = keyNamePrefix + dstkey;
        }

        return ResolveResult.UnRenamedBefore(key, dstkey);
    }

    public ResolveResult sunion(String... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult sunionstore(String dstkey, String... keys) {
        boolean renamedBefore = true;
        renamedBefore = renamedBefore && dstkey.startsWith(keyNamePrefix);

        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(dstkey, keys);
        }

        if (!dstkey.startsWith(keyNamePrefix)) {
            dstkey = keyNamePrefix + dstkey;
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(dstkey, keys);
    }

    public ResolveResult watch(String... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult zinterstore(String dstkey, String... sets) {
        boolean renamedBefore = true;
        renamedBefore = renamedBefore && dstkey.startsWith(keyNamePrefix);

        for (String key : sets) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(dstkey, sets);
        }

        if (!dstkey.startsWith(keyNamePrefix)) {
            dstkey = keyNamePrefix + dstkey;
        }

        for (int i = 0; i < sets.length; i++) {
            if (!sets[i].startsWith(keyNamePrefix)) {
                sets[i] = keyNamePrefix + sets[i];
            }
        }

        return ResolveResult.UnRenamedBefore(dstkey, sets);
    }

    public ResolveResult zinterstore(String dstkey, ZParams params, String... sets) {
        boolean renamedBefore = true;
        renamedBefore = renamedBefore && dstkey.startsWith(keyNamePrefix);

        for (String key : sets) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(dstkey, params, sets);
        }

        if (!dstkey.startsWith(keyNamePrefix)) {
            dstkey = keyNamePrefix + dstkey;
        }

        for (int i = 0; i < sets.length; i++) {
            if (!sets[i].startsWith(keyNamePrefix)) {
                sets[i] = keyNamePrefix + sets[i];
            }
        }

        return ResolveResult.UnRenamedBefore(dstkey, params, sets);
    }

    public ResolveResult zunionstore(String dstkey, String... sets) {
        boolean renamedBefore = true;
        renamedBefore = renamedBefore && dstkey.startsWith(keyNamePrefix);

        for (String key : sets) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(dstkey, sets);
        }

        if (!dstkey.startsWith(keyNamePrefix)) {
            dstkey = keyNamePrefix + dstkey;
        }

        for (int i = 0; i < sets.length; i++) {
            if (!sets[i].startsWith(keyNamePrefix)) {
                sets[i] = keyNamePrefix + sets[i];
            }
        }

        return ResolveResult.UnRenamedBefore(dstkey, sets);
    }

    public ResolveResult zunionstore(String dstkey, ZParams params, String... sets) {
        boolean renamedBefore = true;
        renamedBefore = renamedBefore && dstkey.startsWith(keyNamePrefix);

        for (String key : sets) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(dstkey, params, sets);
        }

        if (!dstkey.startsWith(keyNamePrefix)) {
            dstkey = keyNamePrefix + dstkey;
        }

        for (int i = 0; i < sets.length; i++) {
            if (!sets[i].startsWith(keyNamePrefix)) {
                sets[i] = keyNamePrefix + sets[i];
            }
        }

        return ResolveResult.UnRenamedBefore(dstkey, params, sets);
    }

    public ResolveResult brpoplpush(String source, String destination, int timeout) {
        if (source.startsWith(keyNamePrefix) && destination.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(source, destination, timeout);
        }

        if (!source.startsWith(keyNamePrefix)) {
            source = keyNamePrefix + source;
        }

        if (!destination.startsWith(keyNamePrefix)) {
            destination = keyNamePrefix + destination;
        }

        return ResolveResult.UnRenamedBefore(source, destination, timeout);
    }

    public ResolveResult bitop(BitOP op, String destKey, String... srcKeys) {
        boolean renamedBefore = true;
        renamedBefore = renamedBefore && destKey.startsWith(keyNamePrefix);

        for (String key : srcKeys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(op, destKey, srcKeys);
        }

        if (!destKey.startsWith(keyNamePrefix)) {
            destKey = keyNamePrefix + destKey;
        }

        for (int i = 0; i < srcKeys.length; i++) {
            if (!srcKeys[i].startsWith(keyNamePrefix)) {
                srcKeys[i] = keyNamePrefix + srcKeys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(op, destKey, srcKeys);
    }

    public ResolveResult pfmerge(String destkey, String... sourcekeys) {
        boolean renamedBefore = true;
        renamedBefore = renamedBefore && destkey.startsWith(keyNamePrefix);

        for (String key : sourcekeys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(destkey, sourcekeys);
        }

        if (!destkey.startsWith(keyNamePrefix)) {
            destkey = keyNamePrefix + destkey;
        }

        for (int i = 0; i < sourcekeys.length; i++) {
            if (!sourcekeys[i].startsWith(keyNamePrefix)) {
                sourcekeys[i] = keyNamePrefix + sourcekeys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(destkey, sourcekeys);
    }

    public ResolveResult pfcount(String... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult touch(String... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(keys);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(keys);
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(keys);
    }

    public ResolveResult eval(String script, int keyCount, String... params) {
        if (keyCount == 0) {
            return ResolveResult.renamedBefore(script, keyCount, params);
        }

        boolean renamedBefore = true;
        for (int i = 0; i < keyCount; i++) {
            // 所有的key都要以keyNamePrefix开头
            renamedBefore = renamedBefore && params[i].startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        // 不存在key不是以keyNamePrefix开头
        if (renamedBefore) {
            return ResolveResult.renamedBefore(script, keyCount, params);
        }

        // 改变key
        // 看似有2个循环，实质上只有一个循环在真正执行
        for (int i = 0; i < keyCount; i++) {
            if (!params[i].startsWith(keyNamePrefix)) {
                params[i] = keyNamePrefix + params[i];
            }
        }

        return ResolveResult.UnRenamedBefore(script, keyCount, params);
    }

    public ResolveResult eval(String script, List<String> keys, List<String> args) {
        if (keys == null || keys.size() == 0) {
            ResolveResult.renamedBefore(script, keys, args);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            // 所有的key都要以keyNamePrefix开头
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        // 不存在key不是以keyNamePrefix开头
        if (renamedBefore) {
            return ResolveResult.renamedBefore(script, keys, args);
        }

        // 改变key
        // 看似有2个循环，实质上只有一个循环在真正执行
        for (int i = 0; i < keys.size(); i++) {
            if (!keys.get(i).startsWith(keyNamePrefix)) {
                keys.set(i, keyNamePrefix + keys.get(i));
            }
        }

        return ResolveResult.UnRenamedBefore(script, keys, args);
    }

    public ResolveResult evalsha(String sha1, List<String> keys, List<String> args) {
        if (keys == null || keys.size() == 0) {
            ResolveResult.renamedBefore(sha1, keys, args);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            // 所有的key都要以keyNamePrefix开头
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        // 不存在key不是以keyNamePrefix开头
        if (renamedBefore) {
            return ResolveResult.renamedBefore(sha1, keys, args);
        }

        // 改变key
        // 看似有2个循环，实质上只有一个循环在真正执行
        for (int i = 0; i < keys.size(); i++) {
            if (!keys.get(i).startsWith(keyNamePrefix)) {
                keys.set(i, keyNamePrefix + keys.get(i));
            }
        }

        return ResolveResult.UnRenamedBefore(sha1, keys, args);
    }

    public ResolveResult evalsha(String sha1, int keyCount, String... params) {
        if (keyCount == 0) {
            return ResolveResult.renamedBefore(sha1, keyCount, params);
        }

        boolean renamedBefore = true;
        for (int i = 0; i < keyCount; i++) {
            // 所有的key都要以keyNamePrefix开头
            renamedBefore = renamedBefore && params[i].startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        // 不存在key不是以keyNamePrefix开头
        if (renamedBefore) {
            return ResolveResult.renamedBefore(sha1, keyCount, params);
        }

        // 改变key
        // 看似有2个循环，实质上只有一个循环在真正执行
        for (int i = 0; i < keyCount; i++) {
            if (!params[i].startsWith(keyNamePrefix)) {
                params[i] = keyNamePrefix + params[i];
            }
        }

        return ResolveResult.UnRenamedBefore(sha1, keyCount, params);
    }

    //*******************************cluster中特有的方法
    public ResolveResult eval(byte[] script, byte[] sampleKey) {
        String sourceKey = keyDeserializer.deserialize(sampleKey);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(script, sampleKey);
        }

        String destKey = keyNamePrefix + sourceKey;
        sampleKey = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(script, sampleKey);
    }

    public ResolveResult eval(String script, String sampleKey) {
        if (sampleKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(script, sampleKey);
        }

        sampleKey = keyNamePrefix + sampleKey;
        return ResolveResult.UnRenamedBefore(script, sampleKey);
    }

    public ResolveResult evalsha(byte[] sha1, byte[] sampleKey) {
        String sourceKey = keyDeserializer.deserialize(sampleKey);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(sha1, sampleKey);
        }

        String destKey = keyNamePrefix + sourceKey;
        sampleKey = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(sha1, sampleKey);
    }

    public ResolveResult evalsha(String sha1, String sampleKey) {
        if (sampleKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(sha1, sampleKey);
        }

        sampleKey = keyNamePrefix + sampleKey;
        return ResolveResult.UnRenamedBefore(sha1, sampleKey);
    }

    //*******************************pipeline中特有的方法
    public ResolveResult migrate(String host, int port, byte[] key, int destinationDB, int timeout) {
        String sourceKey = keyDeserializer.deserialize(key);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(host, port, key, destinationDB, timeout);
        }

        String destKey = keyNamePrefix + sourceKey;
        key = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(host, port, key, destinationDB, timeout);
    }

    public ResolveResult migrate(String host, int port, int destinationDB, int timeout, MigrateParams params, byte[]... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(host, port, destinationDB, timeout, params, keys);
        }

        boolean renamedBefore = true;
        for (byte[] key : keys) {
            String sourceKey = keyDeserializer.deserialize(key);
            renamedBefore = renamedBefore && sourceKey.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(host, port, destinationDB, timeout, params, keys);
        }

        for (int i = 0; i < keys.length; i++) {
            String sourceKey = keyDeserializer.deserialize(keys[i]);
            if (!sourceKey.startsWith(keyNamePrefix)) {
                String destKey = keyNamePrefix + sourceKey;
                keys[i] = keySerializer.serialize(destKey);
            }
        }

        return ResolveResult.UnRenamedBefore(host, port, destinationDB, timeout, params, keys);
    }

    public ResolveResult migrate(String host, int port, int destinationDB, int timeout, MigrateParams params, String... keys) {
        if (keys == null || keys.length == 0) {
            return ResolveResult.renamedBefore(host, port, destinationDB, timeout, params, keys);
        }

        boolean renamedBefore = true;
        for (String key : keys) {
            renamedBefore = renamedBefore && key.startsWith(keyNamePrefix);
            if (!renamedBefore) {
                break;
            }
        }

        if (renamedBefore) {
            return ResolveResult.renamedBefore(host, port, destinationDB, timeout, params, keys);
        }

        for (int i = 0; i < keys.length; i++) {
            if (!keys[i].startsWith(keyNamePrefix)) {
                keys[i] = keyNamePrefix + keys[i];
            }
        }

        return ResolveResult.UnRenamedBefore(host, port, destinationDB, timeout, params, keys);
    }

    public ResolveResult migrate(String host, int port, String key, int destinationDB, int timeout) {
        if (key.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(host, port, key, destinationDB, timeout);
        }

        key = keyNamePrefix + key;

        return ResolveResult.UnRenamedBefore(host, port, key, destinationDB, timeout);
    }

    public ResolveResult blpop(byte[] arg) {
        String sourceKey = keyDeserializer.deserialize(arg);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(arg);
        }

        String destKey = keyNamePrefix + sourceKey;
        arg = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(arg);
    }

    public ResolveResult brpop(byte[] arg) {
        String sourceKey = keyDeserializer.deserialize(arg);
        if (sourceKey.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(arg);
        }

        String destKey = keyNamePrefix + sourceKey;
        arg = keySerializer.serialize(destKey);

        return ResolveResult.UnRenamedBefore(arg);
    }

    public ResolveResult blpop(String arg) {
        if (arg.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(arg);
        }

        arg = keyNamePrefix + arg;
        return ResolveResult.UnRenamedBefore(arg);
    }

    public ResolveResult brpop(String arg) {
        if (arg.startsWith(keyNamePrefix)) {
            return ResolveResult.renamedBefore(arg);
        }

        arg = keyNamePrefix + arg;
        return ResolveResult.UnRenamedBefore(arg);
    }
}
